const express = require('express');
const app = express();
app.get('/',(request,response)=>{
    // 请求
    console.log(request.url);   //请求地址
    console.log(request.method);  //请求方法
    console.log(request.headers); // 请求头
    console.log('请求参数',request.query);
    // 设置响应状态码
    // response.statusCode = 201;
    //结束响应
    // response.end();
    // response.send('post /');
    // 原生是没有这些扩展方法的 这是express框架提供的
    response.cookie('foo','bar');
    response.status(201).send('OK');
});
app.post('/',(request,response)=>{
    response.send('post /');
});
app.put('/user',(request,response)=>{
    response.send('put user/');
});
app.delete('/user',(request,response)=>{
    response.send('delete user /');
});
app.listen(3000,()=>{
    console.log('02server running at http://localhost:3000');
});